﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using Eagle.Data;
using System.Data;
using System.Reflection;
using Eagle.Common;
using log4net;
using System.Net;
using Eagle.Module.Office;
using System.IO;

namespace Eagle.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            //Response.Write( Eagle.Config.EagleSettings.Instance.CacheClassName);
            //List<string> aname = new List<string>(10);
            //List<string> avalue = new List<string>(10);
            //Eagle.Config.EagleSettings ds = new Eagle.Config.EagleSettings();
            //Type t = ds.GetType();
            //foreach (PropertyInfo p in t.GetProperties())
            //{
            //    aname.Add(p.Name);
            //    avalue.Add("1");
            //}
            //XmlExtend.CreateXmlForElements(aname.ToArray(), avalue.ToArray(), Utils.ConvertToPhysicalPath("/J.XML"), true, "", false);
            //logger.Fatal("ddd");
            //logger.Error("ddd");
            //try
            //{
            //    Eagle.Data.DbUtils.ExecuteNonQuery("", CommandType.Text, "", false, null);
            //}
            //catch (Exception ex)
            //{
            //    Utils.WriteErrorToTxt(ex.ToString());
            //}

            //int a = 0, b = 0;
            //Response.Write(a++ + "<br>");
            //Response.Write(a + "<br>");
            //Response.Write(++b + "<br>");
            //Response.Write(b + "<br>");
            //Eagle.Module.Email email = new Eagle.Module.Email("您好", "5xjc5@163.com", "我打算测试一下组件", "测试测试");
            //email.Port = 587;
            //email.EnableSsl = true;
            //email.ServerEmailName = "tuyadao@gmail.com";
            //email.ServerEmailPassword = "75521982";
            //email.ServerEmailSmtp = "smtp.gmail.com";
            //if (email.Send())
            //{
            //    Response.Write("成功");
            //}
            //else {
            //    Response.Write("失败");
            //}

            //List<string> xpath = new List<string>();
            //xpath.Add("/book-metadata/BookID");
            //xpath.Add("/book-metadata/bib-metadata/Creator");
            //Dictionary<string, string> a = XmlExtend.GetXmlElementsByXmlDocument(Utils.ConvertToPhysicalPath("/1.xml"), xpath.ToArray());
            //foreach (string key in a.Keys)
            //{
            //    Response.Write(key+" ---- "+a[key]+"<Br>");
            //}
            ////System.Threading.ThreadStart ts = new System.Threading.ThreadStart(log);
            ////List<System.Threading.Thread> tts = new List<System.Threading.Thread>(1000);
            ////for (int i = 0; i < 1000; i++)
            ////{
            ////    System.Threading.Thread t = new System.Threading.Thread(ts);
            ////    tts.Add(t);
            ////}
            ////for (int i = 0; i < 1000; i++)
            ////{
            ////    tts[i].Start();
            ////}
            //StreamReader sr = new StreamReader("E:\\1.txt");
            //binar
            List<Excel.Sheet> sheets = Excel.GetSheetName("E:\\book1.xls");
            foreach (Excel.Sheet sheet in sheets)
            {
                Response.Write(sheet.Name + "<br>");
            }
            //DataTable dt=Excel.GetSheetData("f:\\tlx\\mydatatest.xls",0,"[条码] as a,[种次号] as b,[分类号] as c,[卷册号] as d");
            //foreach (DataRow dr in dt.Rows)
            //{
            //    foreach (DataColumn dc in dt.Columns)
            //    {
            //        Response.Write(dr[dc.ColumnName].ToString() + "-");
            //    }
            //    Response.Write("<br>");
            //}
              //Response.Write(EagleUtils.CutString("中国d就dddd",6,false,EagleUtils.CutType.Varchar));
        }

        private static void log()
        {
            EagleUtils.WriteErrorToTxt("eee");
        }
    }
}
